/**
 * @file   1081.cpp
 * @author Shuang Hu <hsmath@ubuntu>
 * @date   Wed Jul 14 06:58:39 2021
 * 
 * @brief  PAT advanced 1081
 * 
 * 
 */
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;
long int gcd(long int a,long int b){
    if(b==0){
	return a;
    }
    return gcd(b,a%b);
}
class fenshu{
private:
    long int fz;
    long int fm;
public:
    fenshu(long int a,long int b){
	fz=a;
	fm=b;
    }
    fenshu& operator=(const fenshu& frac){
	fz=frac.fz;
	fm=frac.fm;
	return *this;
    }
    void yuefen(){
	long int d=gcd(abs(fz),abs(fm));
	fz=fz/d;
	fm=fm/d;
    }
    fenshu& operator+(const fenshu& frac){
	long int d2=fm*(frac.fm);
	long int d1=fz*(frac.fm)+fm*(frac.fz);
	fz=d1;
	fm=d2;
	return *this;
    }
    void print(){
	if(fm==1){
	    cout<<fz<<endl;
	    return;
	}
	if(abs(fz)>fm){
	    if(fz>0){
		int d=fz/fm;
		int r=fz-d*fm;
		cout<<d<<" "<<r<<"/"<<fm<<endl;
		return;
	    }else{
		int d=abs(fz)/fm;
		int r=abs(fz)-d*fm;
		cout<<"-"<<d<<" "<<r<<"/"<<fm<<endl;
		return;
	    }
	}
	cout<<fz<<"/"<<fm<<endl;
	return;
    }
};
int main(){
    int nums;
    cin>>nums;
    fenshu F(0,1);
    for(int i=0;i<nums;i++){
	int a,b;
	scanf("%d/%d",&a,&b);
	fenshu add(a,b);
	F=F+add;
	F.yuefen();
    }
    F.print();
}
